<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
  <meta charset="UTF-8">
  <title>历史新闻</title>
  <meta name="viewport" content="width=device-width, initial-scale=1.0">

  <!-- Layui样式 -->
  <link rel="stylesheet" th:href="@{/layui/css/layui.css}">
  <style>
    .main-container {
      max-width: 1200px;
      margin: 20px auto;
      padding: 20px;
      background: #fff;
      border-radius: 8px;
      box-shadow: 0 2px 15px rgba(0,0,0,0.1);
    }

    .layui-table {
      margin-top: 20px;
    }

    .back-btn {
      position: fixed;
      top: 20px;
      right: 20px;
      z-index: 1000;
    }
  </style>
</head>
<body>
<!-- 返回按钮 -->
<div class="back-btn">
  <a href="/toChina" class="layui-btn layui-btn-primary">返回首页</a>
</div>

<div class="main-container">
  <h1 class="layui-h1" style="text-align: center;">历史新闻列表</h1>

  <table class="layui-table" lay-even>
    <colgroup>
      <col width="20%">
      <col width="50%">
      <col width="20%">
      <col width="10%">
    </colgroup>
    <thead>
    <tr>
      <th>序号</th>
      <th>标题</th>
      <th>发布时间</th>
      <th>发布者</th>
    </tr>
    </thead>
    <tbody>
    <tr th:each="news, iterStat : ${pastNewsList}">
      <td th:text="${iterStat.index + 1}"></td>
      <td><a th:href="@{/news/detail/{id}(id=${news.id})}" th:text="${news.title}"></a></td>
      <td th:text="${#dates.format(news.createTime, 'yyyy-MM-dd HH:mm:ss')}"></td>
      <td th:text="${news.pubulishby}"></td>
    </tr>
    </tbody>
  </table>
</div>

<script th:src="@{/layui/layui.js}"></script>
</body>
</html>